package android.alliance.ads.example;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import android.alliance.ads.AdAdapter;
import android.alliance.ads.example.helper.ProVersion;
import android.alliance.ads.interfaces.IBannerCallback;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;

/**
 * Android Alliance - Ads-Library
 *
 * Copyright (c) 2011-2014 Android Alliance
 *
 * http://www.android-alliance.org
 * http://www.droidspirit.com
 * http://www.strangeoptics.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 
 * this file except in compliance with the License. You may obtain a copy of the License at  
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 * 
 *  E-Mail: support@droidspirit.com
 */
public class ImplementationSimple extends Activity {

	private AdAdapter adapter = AdAdapter.getInstance();
	private Activity parentActivity;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ad_example_layout);
	
		parentActivity = this;
		
		Button btShowFullscreenAd = (Button) findViewById(R.id.btFullscreenad);
		btShowFullscreenAd.setOnClickListener(new OnClickListener(){

			@Override
			public void onClick(View v) {
				// To start fullscreen-ad call
				adapter.initFullscreenBannerAds(parentActivity, null);
			}
			
		});
		
		
		FrameLayout adLayoutBanner = (FrameLayout) findViewById(R.id.adLayoutMain);

		if(ProVersion.isProVersion()){
    		adLayoutBanner.removeAllViews();
    		adLayoutBanner.setMinimumHeight(0);
    	} else {
    		adapter.initBannerAds(this, adLayoutBanner, null);
    	}
		
	}
	
	@Override
	public void onBackPressed() {
		Intent mainIntent = new Intent(this, MainActivity.class);
		startActivity(mainIntent);
		finish();
	}
}
